
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using My.Resources;




public partial class SaveFileDialog 
{

    public string Res = null;

    public SaveFileDialog()
    {
        InitializeComponent();
    }
    public void SetFileInfo(string name, RichTextBox RTB)
    {
        Label1.Content = "Do you want to save " + name;
        RichTextBox1.AppendText("");
    }

    #region Buttons

    public void YesButton_Click(System.Object sender, RoutedEventArgs e)
    {
        Res = "Yes";
        Close();
    }

    public void NoButton_Click(object sender, RoutedEventArgs e)
    {
        Res = "No";
        Close();
    }

    public void CancelButton_Click(object sender, RoutedEventArgs e)
    {
        Res = null;
        Close();
    }

    #endregion

    public void SaveFileDialog_Closing(object sender, System.ComponentModel.CancelEventArgs e)
    {
        if (this.WindowState == System.Windows.WindowState.Maximized)
        {
            MySettings.Default.SaveDialog_IsMax = true;
        }
        else
        {
            MySettings.Default.SaveDialog_IsMax = false;
        }
    }

    public void SaveFileDialog_Loaded(object sender, RoutedEventArgs e)
    {
        System.IO.FileStream fs = System.IO.File.OpenRead(My.MyWpfExtension.Computer.FileSystem.SpecialDirectories.Temp + "\\TVPre.xaml");
        TextRange tr = new TextRange(RichTextBox1.Document.ContentStart, RichTextBox1.Document.ContentEnd);
        FlowDocument content = System.Windows.Markup.XamlReader.Load(fs) as FlowDocument;
        RichTextBox1.Document = content;
        fs.Close();
        if (MS.WindowsAPICodePack.Internal.CoreHelpers.RunningOnWin7 || MS.WindowsAPICodePack.Internal.CoreHelpers.RunningOnVista)
        {
            AppHelper.ExtendGlassFrame(this, new Thickness(-1, -1, -1, -1));
        }
        if (MySettings.Default.SaveDialog_IsMax)
        {
            this.WindowState = System.Windows.WindowState.Maximized;
        }
        else
        {
            this.WindowState = System.Windows.WindowState.Normal;
        }
    }
}

